aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/send/invoice/[id]/+page.server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(app)/send/invoice/[id]/+page.server.ts')
-rw-r--r--src/routes/(app)/send/invoice/[id]/+page.server.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.ts b/src/routes/(app)/send/invoice/[id]/+page.server.ts
index 59add224..dfbe9d26 100644
--- a/src/routes/(app)/send/invoice/[id]/+page.server.ts
+++ b/src/routes/(app)/send/invoice/[id]/+page.server.ts
@@ -12,7 +12,7 @@ export async function load({ cookies, depends, params: { id }, parent }) {
const trust = await get("/trust", auth(cookies));
const trusted = trust.includes(invoice.uid);
- if (trusted && (pin || !user.haspin)) {
+ if (trusted && (pin || !user.haspin) && invoice.amount) {
let p;
try {
if (!invoice.tip && invoice.user.prompt) {
@@ -37,8 +37,12 @@ export async function load({ cookies, depends, params: { id }, parent }) {
if (invoice.memoPrompt && invoice.memo === null) redirect(307, `/invoice/${id}/memo`);
if (user && invoice.aid === aid) error(500, { message: "Cannot send to self" });
- else if (user && ![types.lightning, types.bolt12].includes(invoice.type))
- redirect(307, `/send/${invoice.type === types.ecash ? "ecash" : "bitcoin"}/${invoice.hash}`);
+ else if (user && ![types.lightning, types.bolt12].includes(invoice.type)) {
+ // Don't redirect custodial bitcoin invoices — they should be paid internally
+ const isVault = invoice.account?.pubkey || invoice.account?.seed;
+ if (invoice.type !== types.bitcoin || isVault)
+ redirect(307, `/send/${invoice.type === types.ecash ? "ecash" : "bitcoin"}/${invoice.hash}`);
+ }
if (!user) redirect(307, `/invoice/${id}`);